#include "pm/summary.h"
#include "pm/dbobject.h"
#include <wx/log.h>

using namespace pm;


Summary::Summary()
: m_idProject(db::Object::undefined)
, m_workRequest(0.0)
, m_cost(0.0)
, m_todo(0.0)
{
}

Summary::Summary(wxSQLite3ResultSet& res)
: m_idProject(  res.GetInt   (wxT("id_project"),   db::Object::undefined))
, m_workRequest(res.GetDouble(wxT("work_request"), 0.0))
, m_cost(       res.GetDouble(wxT("cost"),         0.0))
, m_todo(       res.GetDouble(wxT("todo"),         0.0))
{
}


GetSummaryByProject::GetSummaryByProject(db::ID idProject)
: m_idProject(idProject)
{
}
	
wxSQLite3Statement GetSummaryByProject::prepare(wxSQLite3Database& db)
{
	wxSQLite3Statement stmt =  db.PrepareStatement("select id_project, work_request, cost, todo from view_summary where id_project = ?");
	stmt.Bind(1, m_idProject);
	return stmt;
}
